<extend name="Template:main/content" />
<block name="page-content-wrapper-content">
<div id="content-header">
		<div id="breadcrumb"> <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>开奖记录管理</a>
		 <a href="__CONTROLLER__/index" form-type='content'>开奖记录</a> 
		 <a>添加</a>
		 </div>
</div>
<div class="container-fluid">
	<hr>
	<div class="row-fluid">
		<div class="span12">
			<div class="widget-box">
				<div class="widget-title">
					<span class="icon"> <i class="icon-info-sign"></i>
					</span>
					<h5>申请提款</h5>
				</div>
				<div class="widget-content nopadding">
					<form class="form-horizontal"  method="post"
						action="__CONTROLLER__/insert" name="basic_validate"
						id="basic_validate" novalidate="novalidate" >
						<input type="hidden" name="_order" value="date"/>
						<input type="hidden" name="_sort" value="desc"/>
						<div class="control-group">
							<label class="control-label">可提余额</label>
							<div class="controls">
								<input type="text"  value={$bean.money} id="agent_money" disabled="disabled" style="width:40%!important">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">提款金额</label>
							<div class="controls">
								<input type="number" name="money"  id="money"  placeholder='请整数,如 100'  verify="between_1_{$bean.money}" style="width:40%!important">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">开户支行</label>
							<div class="controls">
								<input type="text" name="bank_name" id="bank_name"  placeholder='中国XX银行XXX支行'  verify="empty" style="width:40%!important">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">银行卡</label>
							<div class="controls">
								<input type="text" name="account"  id="account" placeholder='62200220665566522'  verify="empty"  style="width:40%!important">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">开卡户名</label>
							<div class="controls">
								<input type="text" name="account_username"  id="account_username" placeholder='张三'  verify="empty"  style="width:40%!important">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">手机号</label>
							<div class="controls">
								<input type="text" name="phone" id="phone" value="{$bean.phone}"   style="width:10%!important"  readonly ="readonly">
								<a href="#"><button class="btn btn-info btn-mini"  id="gain"  type="button">点击获取验证码</button></a>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">验证码</label>
							<div class="controls">
								<input type="text" name="code"    verify="empty"  style="width:10%!important">
							</div>
						</div>
						<div class="form-actions">
							<button type="submit" class="btn btn-success"
								form-type="form-content">添加</button>
							<a href="__CONTROLLER__/index" form-type='content'>
								<button class="btn btn-success">返回</button>
							</a>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
	<script
	src="__PUBLIC__/agent/js/insert.js"
	type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var countdown=60; 
		//发送验证码
			function settime(obj) { //发送验证码倒计时
			    if (countdown == 0) { 
			        obj.attr('disabled',false); 
			        //obj.removeattr("disabled"); 
			        obj.text("免费获取验证码");
			        countdown = 60; 
			        return;
			    } else { 
			        obj.attr('disabled',true);
			        obj.text("重新发送(" + countdown + ")");
			        countdown--; 
			    } 
			setTimeout(function() { 
			    settime(obj) }
			    ,1000) 
			}
		$('#gain')
				.click(
						function() {
							
							var money = $('#money').val();
							var bank_name = $('#bank_name').val();
							var account = $('#account').val();
							var account_username = $('#account_username').val();
							if(money==''||bank_name==''||account==''||account_username==''){
								alert("请先完善提款信息!");
								return;
							}
							
							var phone = $('#phone').val();
							var agent_em_gs = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
							if (!agent_em_gs.test(phone)) {
								alert("手机格式不正确，请修改!");
							} else {
								$.ajax({
									url : "__APP__/Home/Sms/drawings_send_message",
									data : {
										'phone' : phone
									},
									dataType : "TEXT",
									type : "POST",
									success : function(data) {
										if (data == 2) {
											alert("手机号还未注册!");
										} else if(data == 3){
											alert("短信发送太频繁!");
										}else{
											var obj = $("#gain");
											settime(obj);
										}
									}
								});
							}
						});
	</script>
	 </block>